Memory management in computer systems refers to the manner in which multiple applications and an operating system agree on the use of memory. Although each computer system has a fixed amount of physical random access memory (RAM) or other memory, the operating system may present virtual memory to applications and to operating system components that represents a size of memory different from the physical memory. In some cases, virtual memory allows the operating system to restrict each application to accessing a particular portion of memory, to prevent one application from interfering with the operation of another application by accidentally or intentionally modifying the other application's memory. Operating systems generally provide one or more functions for allocating and freeing memory in response to application and operating system component requests. The operating system may provide an application with a memory pool, from which the application can allocate chunks of memory. If an application uses or group of applications together use more virtual memory than the amount of installed physical memory, the operating system may use slower disk-based storage to extend the apparent size of memory through a swap file in a process called paging or disk swapping (i.e., storing and retrieving pages of memory to disk).
Aside from the provided allocation and freeing functions, operating systems have very little insight into how applications use memory. Many computing devices contain particular limitations surrounding memory. For example, mobile computing devices may include a much smaller amount of memory than is typically available on a desktop computer system (or a system may want to de-power some memory to reduce energy consumption), creating limits for the device related to how many applications can run at the same time, how much memory each application can request/consume, and so forth. Other computing environments that host application code within a particular computing system may also enforce limitations or upper bounds on the memory usage of the environment. Hosts, such as VMware and MICROSOFT™ Virtual PC, hypervisors, operating systems, and others may be assigned limited resources. In all of these situations, effective memory management becomes more noticeable.
New computing platforms have introduced new techniques or repurposed old techniques to address the problem of limited memory shared between applications. For example, mobile phone operating systems may create a memory snapshot of each application, such that when the application is not in the foreground (e.g., being actively used) the operating system shuts it down and stores an image of the application's memory on slower storage (e.g., flash memory or other storage). When the application is selected, the operating system reloads the stored image into memory and starts the application. The application may not even be aware that it was shut down. Although such techniques are helpful, the operating system is still subject to the application's opaque requests for using memory. Currently most decisions made regarding dynamic memory usage are made based upon information found during run time. Examples of such information include the size and number of references to an allocated memory segment. This information can then be used to determine which allocations will be paged to disk, cached to high performance memory, or freed by some sort of automatic memory management system. Unfortunately, any platform is limited by potentially many years of legacy applications, so adopting new models in an area as widespread as memory management is difficult.